define(
    function (require, exports) {
        /**
         * 页面加载完成时触发
         * @param hashCode 路由ID
         * @param data 传递数据对象
         * @param cite 页面站点信息
         */
        exports.ready = function (hashCode, data, cite) {
            yufp.custom.vue({
                el: cite.el,
                data: function () {
                    var _this = this;
                    var eventTypeOption = [{ key: 'G', value: '普通事件' },
                        { key: 'F', value: '文件事件' }]

                    var queryTypeOption =[{key:"U",value: "上游"}, {key:"D",value: "下游"} ];

                    return {
                        refAllFormdata: {},
						bloodParam:{},
						currentRootId:'',
                        searchRefFormdata:{},
                        isShowFlowAllRef: data.isShowFlowAllRef,
                        baseFlowRefParams:{condition:{}},
                        eventTypeOption:eventTypeOption,
                        flowRefDataUrl: 'api/use/plats/workflow/getWorkFlowRel',
						xueheight: yufp.frame.size().height -220,
						height: yufp.frame.size().height -195,
                        baseFlowAllParams:{appCode:data.appCode,groupCode:data.groupCode},
                        queryTypeOptions:queryTypeOption,
                        wftLstOptions:data.wftLstOptions,
						wftLstOptionsName:data.wftLstOptionsName,
                        searchRefAllFormdata:{},
                        flowAllDataUrl:"api/use/plats/workflow/getAllActions",


                    };
                },
				
                mounted: function () {
                    this.refAllFormdata.appCode = data.appCode;
                    this.refAllFormdata.groupCode = data.groupCode;
					//this.setParams();
					var  baseFlowRefParams  ={condition:{}};
					baseFlowRefParams.condition = {
						'appCode':data.appCode,
						'appName':data.appName,
						'groupCode':data.groupCode
					};
					this.baseFlowRefParams = baseFlowRefParams;
                },
                methods: {
					setParams:function(){
						//wftLstOptions
						var actionCode = this.refAllFormdata.actionCode;
						var actionName = '';
						for(var item in this.wftLstOptions){
							if(this.wftLstOptions[item].key == actionCode){
								actionName = this.wftLstOptions[item].actionName;
								break;
							}
						}
						this.bloodParam = {
							appCode:this.refAllFormdata.appCode,
							groupCode:this.refAllFormdata.groupCode,
							actionCode:actionCode,
							actionName:actionName,
							queryType:this.refAllFormdata.queryType,
							rootId:this.refAllFormdata.appCode+','+this.refAllFormdata.groupCode+','+this.refAllFormdata.actionCode
						};
						this.currentRootId = this.bloodParam.rootId;
					},
                    tableRowClassName:function(data,index){

                        if(data.row.eventCode!=null&&data.row.eventType==null){
                            return "positive-row";
                        }else if(data.row.eventType!=null&&data.row.eventType==='G'&&(data.row.relJobCode===null|| data.row.relJobCode==='')) {
                            return "positive-row";
                        }

                        return  "";
                    },

                    queryRefAllData:function(){
                        var _this = this;
                        _this.$refs.refAllFormdata.validate(function (valid) {
                            validate = valid;
							if(validate){
								_this.setParams();				
							}
                        });

                        if(!validate){
                            return ;
                        }
                        _this.$refs.refFlowAllTable.remoteData();
                    },

                    resetForm:function(){
                        this.refAllFormdata.actionCode="";
                        this.refAllFormdata.queryType="";
                        this.refAllFormdata.level=0;
                    }




                },

            });
        };
    });